use std::{ops::Deref, sync::{Arc, Mutex}};

use amiquip::{Connection, ExchangeType};

use crate::{
    rabbitmq::{self, rabbitmq_test::MqBase},
    thread_safe_ptr,
};

pub mod rabbitmq_test;

#[test]
pub fn test_mq() {
    let mut conn = Connection::insecure_open("amqp://admin:leyo@@123@192.168.27.57:5672").unwrap();
    let channel = Arc::new(Mutex::new(conn.open_channel(None).unwrap()));
    let mq_base = MqBase {
        exchange_type: ExchangeType::Direct,
        exchange: "solar.exchange".to_string(),
        queue: "solar.queue.stock".to_string(),
        key: "solar.queue.stock".to_string(),
    };
    thread_safe_ptr!(mq_base);
    mq_base.declare_and_bind(channel.lock().unwrap().deref());

    let msg = rabbitmq_test::OutOrderItemRequestList::default();
}
